[feat/MAT-359] 텍스트박스 추출#301
Closed
b0nsu wants to merge 4 commits intorefactor/mat-358-undo-redofrom
Closed
Conversation
- model/drawingTypes.ts: Point, Stroke, TextItem, DrawingCanvasRef 추출 + ReadonlyPoint, ReadonlyStroke (불변 참조용, deepCopy 줄이는 기반) + StrokeBounds (지우개 히트 테스트 최적화 기반) - model/strokeUtils.ts: deepCopyStrokes, deepCopyTexts, safeMax 추출 + computeStrokeBounds (single-pass O(n) AABB 계산) - smoothing.ts: 로컬 Point 제거, drawingTypes에서 import - DrawingCanvas.tsx: 인라인 타입/유틸 제거, model에서 import - index.ts: 새 타입/유틸 re-export 추가 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- render/skia/skiaRenderUtils.ts: wrapTextToLines (중복 텍스트 줄바꿈 로직 통합) - render/skia/useSkiaDrawingRenderer.tsx: renderedPaths, renderedTexts, hoverOpacity 훅 - render/skia/SkiaDrawingCanvasSurface.tsx: Canvas 래퍼 컴포넌트 - DrawingCanvas.tsx: calculateTextLineCount를 wrapTextToLines 기반으로 단순화 - DrawingCanvas.tsx에서 렌더링 로직 136줄 제거 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- engine/HistoryManager.ts: command 패턴 (AppendStroke, EraseStrokes, ReplaceDocument) - append-stroke undo O(1): slice로 마지막 stroke 제거 (deepCopy + path rebuild 제거) - erase transaction: beginTransaction/commitTransaction - lock/unlock: 텍스트 편집 중 canvas undo 차단 - cachedPathsBefore 구조 준비 (renderer 연동 후 적용) - model/drawingTypes.ts: DocumentSnapshot 타입 추가 - DrawingCanvas.tsx: 기존 historyRef/historyIndexRef/saveToHistory/restoreFromHistory 제거 → HistoryManager + createSnapshot/applySnapshot으로 교체 (-225줄, +129줄) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- textbox/textBoxTypes.ts: ActiveTextInput 타입, 텍스트 상수 (TEXT_FONT_SIZE, TEXT_LINE_HEIGHT, TEXT_COLOR) - textbox/TextBoxEditingOverlay.tsx: TextBoxEditingOverlay + TextDeleteButtons 컴포넌트 - DrawingCanvas.tsx: - isNearExistingText 제거 (240에서 삭제된 옛날 기획) - 기본 strokeColor 'black' → '#1E1E21' (240 기준) - inline TextInput/삭제 버튼 JSX → 컴포넌트로 교체 - 매직넘버 22.5 → TEXT_LINE_HEIGHT 상수 - 미사용 import/스타일 제거 (-185줄) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
Pull request overview
DrawingCanvas 내부에 있던 텍스트박스 편집/삭제 UI 로직을 textbox/ 디렉토리로 분리해 모듈 경계를 명확히 하고, 텍스트 관련 상수/타입을 재사용 가능하게 정리하는 PR입니다.
Changes:
- 텍스트 입력 오버레이 및 텍스트 삭제 버튼 UI를
TextBoxEditingOverlay.tsx로 추출 - 텍스트 입력 상태 타입과 텍스트 스타일 상수들을
textBoxTypes.ts로 분리 - DrawingCanvas에서 텍스트 관련 인라인 구현 제거 및 신규 모듈 import로 전환,
isNearExistingText로직 제거
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/pointer-native-drawing/src/textbox/textBoxTypes.ts | 텍스트 입력 상태 타입과 텍스트 스타일 상수 정의를 분리해 재사용 기반 마련 |
| packages/pointer-native-drawing/src/textbox/TextBoxEditingOverlay.tsx | 텍스트 편집 오버레이 + 삭제 버튼 렌더링을 컴포넌트로 추출 |
| packages/pointer-native-drawing/src/DrawingCanvas.tsx | 텍스트 UI 렌더링을 추출 컴포넌트로 교체하고 line-height 상수화 및 불필요 로직 제거 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| style={[ | ||
| styles.textInputWrapper, | ||
| { | ||
| left: Math.max(0, Math.min(activeTextInput.x, containerWidth - 200)), |
Comment on lines
53
to
55
| { | ||
| strokeColor = 'black', | ||
| strokeColor = '#1E1E21', | ||
| strokeWidth = 3, |
521676e to
d27224b
Compare
Collaborator
Author
|
텍스트박스 비활성화 정책으로 추출 의의 소멸 — PR #298에 흡수. 후속 PR base는 PR #300 (#358)으로 직접 이동. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DrawingCanvas에서 텍스트박스 관련 로직을
textbox/디렉토리로 추출합니다.isNearExistingText 제거 (옛날 기획), TextBoxEditingOverlay + textBoxTypes 분리.
Linear
Changes
textbox/TextBoxEditingOverlay.tsx— 텍스트 입력/삭제 UI 컴포넌트textbox/textBoxTypes.ts— ActiveTextInput, TEXT_LINE_HEIGHT 타입Testing
pnpm typecheck통과pnpm lint통과Risk / Impact